home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / inferior.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-03  |  8.1 KB  |  342 lines

  1. /* Variables that describe the inferior process running under GDB:
  2.    Where it is, why it stopped, and how to step it.
  3.    Copyright 1986, 1989, 1992 Free Software Foundation, Inc.
  4.  
  5. This file is part of GDB.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #if !defined (INFERIOR_H)
  22. #define INFERIOR_H 1
  23.  
  24. /* For symtab_and_line */
  25. #include "symtab.h"
  26.  
  27. /* For bpstat.  */
  28. #include "breakpoint.h"
  29.  
  30. /* For FRAME_ADDR.  */
  31. #include "frame.h"
  32.  
  33. /*
  34.  * Structure in which to save the status of the inferior.  Save
  35.  * through "save_inferior_status", restore through
  36.  * "restore_inferior_status".
  37.  * This pair of routines should be called around any transfer of
  38.  * control to the inferior which you don't want showing up in your
  39.  * control variables.
  40.  */
  41. struct inferior_status {
  42.   int pc_changed;
  43.   int stop_signal;
  44.   int stop_pc;
  45.   FRAME_ADDR stop_frame_address;
  46.   bpstat stop_bpstat;
  47.   int stop_step;
  48.   int stop_stack_dummy;
  49.   int stopped_by_random_signal;
  50.   int trap_expected;
  51.   CORE_ADDR step_range_start;
  52.   CORE_ADDR step_range_end;
  53.   FRAME_ADDR step_frame_address;
  54.   int step_over_calls;
  55.   CORE_ADDR step_resume_break_address;
  56.   int stop_after_trap;
  57.   int stop_soon_quietly;
  58.   FRAME_ADDR selected_frame_address;
  59.   int selected_level;
  60.   char stop_registers[REGISTER_BYTES];
  61.   int breakpoint_proceeded;
  62.   int restore_stack_info;
  63.   int proceed_to_finish;
  64. };
  65.  
  66. extern void
  67. save_inferior_status PARAMS ((struct inferior_status *, int));
  68.  
  69. extern void
  70. restore_inferior_status PARAMS ((struct inferior_status *));
  71.  
  72. /* File name for default use for standard in/out in the inferior.  */
  73.  
  74. extern char *inferior_io_terminal;
  75.  
  76. /* Pid of our debugged inferior, or 0 if no inferior now.  */
  77.  
  78. extern int inferior_pid;
  79.  
  80. /* Character array containing an image of the inferior programs' registers.  */
  81.  
  82. extern char registers[];
  83.  
  84. extern void
  85. clear_proceed_status PARAMS ((void));
  86.  
  87. extern void
  88. proceed PARAMS ((CORE_ADDR, int, int));
  89.  
  90. extern void
  91. kill_inferior PARAMS ((void));
  92.  
  93. extern void
  94. kill_inferior_fast PARAMS ((void));
  95.  
  96. extern void
  97. generic_mourn_inferior PARAMS ((void));
  98.  
  99. extern void
  100. terminal_ours PARAMS ((void));
  101.  
  102. extern void
  103. run_stack_dummy PARAMS ((CORE_ADDR, char [REGISTER_BYTES]));
  104.  
  105. extern CORE_ADDR
  106. read_pc PARAMS ((void));
  107.  
  108. extern void
  109. write_pc PARAMS ((CORE_ADDR));
  110.  
  111. extern void
  112. wait_for_inferior PARAMS ((void));
  113.  
  114. extern void
  115. init_wait_for_inferior PARAMS ((void));
  116.  
  117. extern void
  118. close_exec_file PARAMS ((void));
  119.  
  120. extern void
  121. reopen_exec_file PARAMS ((void));
  122.  
  123. /* From misc files */
  124.  
  125. extern void
  126. store_inferior_registers PARAMS ((int));
  127.  
  128. extern void
  129. fetch_inferior_registers PARAMS ((int));
  130.  
  131. extern void 
  132. solib_create_inferior_hook PARAMS ((void));
  133.  
  134. extern void
  135. child_mourn_inferior PARAMS ((void));
  136.  
  137. extern void
  138. child_terminal_info PARAMS ((char *, int));
  139.  
  140. extern void
  141. term_info PARAMS ((char *, int));
  142.  
  143. extern void
  144. terminal_ours_for_output PARAMS ((void));
  145.  
  146. extern void
  147. terminal_inferior PARAMS ((void));
  148.  
  149. extern void
  150. terminal_init_inferior PARAMS ((void));
  151.  
  152. /* From infptrace.c or procfs.c */
  153.  
  154. extern int
  155. attach PARAMS ((int));
  156.  
  157. void
  158. detach PARAMS ((int));
  159.  
  160. extern void
  161. child_resume PARAMS ((int, int));
  162.  
  163. extern int
  164. call_ptrace PARAMS ((int, int, int *, int));
  165.  
  166. /* From procfs.c */
  167.  
  168. #ifdef USE_PROC_FS
  169.  
  170. extern int
  171. proc_iterate_over_mappings PARAMS ((int (*) (int, CORE_ADDR)));
  172.  
  173. extern int
  174. proc_wait PARAMS ((int *));
  175.  
  176. extern void
  177. inferior_proc_init PARAMS ((int));
  178.  
  179. extern void
  180. proc_signal_handling_change PARAMS ((void));
  181.  
  182. extern void
  183. proc_set_exec_trap PARAMS ((void));
  184.  
  185. #endif
  186.  
  187. /* From inflow.c */
  188.  
  189. extern void
  190. new_tty_prefork PARAMS ((char *));
  191.  
  192. /* From infrun.c */
  193.  
  194. extern void
  195. start_remote PARAMS ((void));
  196.  
  197. extern void
  198. child_create_inferior PARAMS ((char *, char *, char **));
  199.  
  200. extern void
  201. child_attach PARAMS ((char *, int));
  202.  
  203. extern void
  204. normal_stop PARAMS ((void));
  205.  
  206. extern int
  207. signal_stop_state PARAMS ((int));
  208.  
  209. extern int
  210. signal_print_state PARAMS ((int));
  211.  
  212. extern int
  213. signal_pass_state PARAMS ((int));
  214.  
  215. /* From infcmd.c */
  216.  
  217. extern void
  218. tty_command PARAMS ((char *, int));
  219.  
  220. extern void
  221. attach_command PARAMS ((char *, int));
  222.  
  223. /* Last signal that the inferior received (why it stopped).  */
  224.  
  225. extern int stop_signal;
  226.  
  227. /* Address at which inferior stopped.  */
  228.  
  229. extern CORE_ADDR stop_pc;
  230.  
  231. /* Stack frame when program stopped.  */
  232.  
  233. extern FRAME_ADDR stop_frame_address;
  234.  
  235. /* Chain containing status of breakpoint(s) that we have stopped at.  */
  236.  
  237. extern bpstat stop_bpstat;
  238.  
  239. /* Flag indicating that a command has proceeded the inferior past the
  240.    current breakpoint.  */
  241.  
  242. extern int breakpoint_proceeded;
  243.  
  244. /* Nonzero if stopped due to a step command.  */
  245.  
  246. extern int stop_step;
  247.  
  248. /* Nonzero if stopped due to completion of a stack dummy routine.  */
  249.  
  250. extern int stop_stack_dummy;
  251.  
  252. /* Nonzero if program stopped due to a random (unexpected) signal in
  253.    inferior process.  */
  254.  
  255. extern int stopped_by_random_signal;
  256.  
  257. /* Range to single step within.
  258.    If this is nonzero, respond to a single-step signal
  259.    by continuing to step if the pc is in this range.  */
  260.  
  261. extern CORE_ADDR step_range_start; /* Inclusive */
  262. extern CORE_ADDR step_range_end; /* Exclusive */
  263.  
  264. /* Stack frame address as of when stepping command was issued.
  265.    This is how we know when we step into a subroutine call,
  266.    and how to set the frame for the breakpoint used to step out.  */
  267.  
  268. extern FRAME_ADDR step_frame_address;
  269.  
  270. /* 1 means step over all subroutine calls.
  271.    -1 means step over calls to undebuggable functions.  */
  272.  
  273. extern int step_over_calls;
  274.  
  275. /* If stepping, nonzero means step count is > 1
  276.    so don't print frame next time inferior stops
  277.    if it stops due to stepping.  */
  278.  
  279. extern int step_multi;
  280.  
  281. /* Nonzero means expecting a trap and caller will handle it themselves.
  282.    It is used after attach, due to attaching to a process;
  283.    when running in the shell before the child program has been exec'd;
  284.    and when running some kinds of remote stuff (FIXME?).  */
  285.  
  286. extern int stop_soon_quietly;
  287.  
  288. /* Nonzero if proceed is being used for a "finish" command or a similar
  289.    situation when stop_registers should be saved.  */
  290.  
  291. extern int proceed_to_finish;
  292.  
  293. /* Save register contents here when about to pop a stack dummy frame,
  294.    if-and-only-if proceed_to_finish is set.
  295.    Thus this contains the return value from the called function (assuming
  296.    values are returned in a register).  */
  297.  
  298. extern char stop_registers[REGISTER_BYTES];
  299.  
  300. /* Nonzero if pc has been changed by the debugger
  301.    since the inferior stopped.  */
  302.  
  303. extern int pc_changed;
  304.  
  305. /* Nonzero if the child process in inferior_pid was attached rather
  306.    than forked.  */
  307.  
  308. extern int attach_flag;
  309.  
  310. /* Possible values for CALL_DUMMY_LOCATION.  */
  311. #define ON_STACK 1
  312. #define BEFORE_TEXT_END 2
  313. #define AFTER_TEXT_END 3
  314.  
  315. #if !defined (CALL_DUMMY_LOCATION)
  316. #define CALL_DUMMY_LOCATION ON_STACK
  317. #endif /* No CALL_DUMMY_LOCATION.  */
  318.  
  319. /* Are we in a call dummy?  The code below which allows DECR_PC_AFTER_BREAK
  320.    below is for infrun.c, which may give the macro a pc without that
  321.    subtracted out.  */
  322. #if !defined (PC_IN_CALL_DUMMY)
  323. #if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
  324. extern CORE_ADDR text_end;
  325. #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
  326.   ((pc) >= text_end - CALL_DUMMY_LENGTH         \
  327.    && (pc) < text_end + DECR_PC_AFTER_BREAK)
  328. #else /* Not before text_end.  */
  329. #if CALL_DUMMY_LOCATION == AFTER_TEXT_END
  330. extern CORE_ADDR text_end;
  331. #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
  332.   ((pc) >= text_end   \
  333.    && (pc) < text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
  334. #else /* On stack.  */
  335. #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
  336.   ((sp) INNER_THAN (pc) && (pc) INNER_THAN (frame_address))
  337. #endif /* On stack.  */
  338. #endif /* Not before text_end.  */
  339. #endif /* No PC_IN_CALL_DUMMY.  */
  340.  
  341. #endif    /* !defined (INFERIOR_H) */
  342.